
MODULE	'devices/keymap',
			'exec/ports',
			'graphics/clip',
			'graphics/gfx',
			'graphics/rastport',
			'graphics/text',
			'intuition/screens',
			'intuition/sghooks',
			'utility/tagitem'

OBJECT Menu
	NextMenu:PTR TO Menu,
	LeftEdge:INT,
	TopEdge:INT,
	Width:INT,
	Height:INT,
	Flags:UWORD,
	MenuName:PTR TO CHAR,
	FirstItem:PTR TO MenuItem,
	JazzX:INT,
	JazzY:INT,
	BeatX:INT,
	BeatY:INT

CONST	MENUENABLED=1,
		MIDRAWN=$100

OBJECT MenuItem
	NextItem:PTR TO MenuItem,
	LeftEdge:INT,
	TopEdge:INT,
	Width:INT,
	Height:INT,
	Flags:UWORD,
	MutualExclude:LONG,
	ItemFill:LONG,
	SelectFill:LONG,
	Command:CHAR,
	SubItem:PTR TO MenuItem,
	NextSelect:UWORD

CONST	CHECKIT=1,
		ITEMTEXT=2,
		COMMSEQ=4,
		MENUTOGGLE=8,
		ITEMENABLED=16,
		HIGHFLAGS=$C0,
		HIGHIMAGE=0,
		HIGHCOMP=$40,
		HIGHBOX=$80,
		HIGHNONE=$C0,
		CHECKED=$100,
		ISDRAWN=$1000,
		HIGHITEM=$2000,
		MENUTOGGLED=$4000

OBJECT Requester
	OlderRequest:PTR TO Requester,
	LeftEdge:INT,
	TopEdge:INT,
	Width:INT,
	Height:INT,
	RelLeft:INT,
	RelTop:INT,
	ReqGadget:PTR TO Gadget,
	ReqBorder:PTR TO Border,
	ReqText:PTR TO IntuiText,
	Flags:UWORD,
	BackFill:CHAR,
	ReqLayer:PTR TO Layer,
	ReqPad1[32]:CHAR,
	ImageBMap:PTR TO BitMap,
	RWindow:PTR TO Window,
	ReqImage:PTR TO Image,
	ReqPad2[32]:CHAR

CONST	POINTREL=1,
		PREDRAWN=2,
		NOISYREQ=4,
		SIMPLEREQ=16,
		USEREQIMAGE=$20,
		NOREQBACKFILL=$40,
		REQOFFWINDOW=$1000,
		REQACTIVE=$2000,
		SYSREQUEST=$4000,
		DEFERREFRESH=$8000

CONST	GD_LEFTEDGE=4

OBJECT Gadget
	NextGadget:PTR TO Gadget,
	LeftEdge:INT,
	TopEdge:INT,
	Width:INT,
	Height:INT,
	Flags:UWORD,
	Activation:UWORD,
	GadgetType:UWORD,
	GadgetRender:LONG,
	SelectRender:LONG,
	GadgetText:PTR TO IntuiText,
	MutualExclude:LONG,
	SpecialInfo:LONG,
	GadgetID:UWORD,
	UserData:LONG

OBJECT ExtGadget OF Gadget
	MoreFlags:LONG,
	BoundsLeftEdge:INT,
	BoundsTopEdge:INT,
	BoundsWidth:INT,
	BoundsHeight:INT

CONST	GFLG_GADGHIGHBITS=3,
		GFLG_GADGHCOMP=0,
		GFLG_GADGHBOX=1,
		GFLG_GADGHIMAGE=2,
		GFLG_GADGHNONE=3,
		GFLG_GADGIMAGE=4,
		GFLG_RELBOTTOM=8,
		GFLG_RELRIGHT=16,
		GFLG_RELWIDTH=$20,
		GFLG_RELHEIGHT=$40,
		GFLG_RELSPECIAL=$4000,
		GFLG_SELECTED=$80,
		GFLG_DISABLED=$100,
		GFLG_LABELMASK=$3000,
		GFLG_LABELITEXT=0,
		GFLG_LABELSTRING=$1000,
		GFLG_LABELIMAGE=$2000,
		GFLG_TABCYCLE=$200,
		GFLG_STRINGEXTEND=$400,
		GFLG_IMAGEDISABLE=$800,
		GFLG_EXTENDED=$8000,
		GACT_RELVERIFY=1,
		GACT_IMMEDIATE=2,
		GACT_ENDGADGET=4,
		GACT_FOLLOWMOUSE=8,
		GACT_RIGHTBORDER=16,
		GACT_LEFTBORDER=$20,
		GACT_TOPBORDER=$40,
		GACT_BOTTOMBORDER=$80,
		GACT_BORDERSNIFF=$8000,
		GACT_TOGGLESELECT=$100,
		GACT_BOOLEXTEND=$2000,
		GACT_STRINGLEFT=0,
		GACT_STRINGCENTER=$200,
		GACT_STRINGRIGHT=$400,
		GACT_LONGINT=$800,
		GACT_ALTKEYMAP=$1000,
		GACT_STRINGEXTEND=$2000,
		GACT_ACTIVEGADGET=$4000,
		GTYP_GADGETTYPE=$FC00,
		GTYP_SYSGADGET=$8000,
		GTYP_SCRGADGET=$4000,
		GTYP_GZZGADGET=$2000,
		GTYP_REQGADGET=$1000,
		GTYP_SIZING=16,
		GTYP_WDRAGGING=$20,
		GTYP_SDRAGGING=$30,
		GTYP_WUPFRONT=$40,
		GTYP_SUPFRONT=$50,
		GTYP_WDOWNBACK=$60,
		GTYP_SDOWNBACK=$70,
		GTYP_CLOSE=$80,
		GTYP_BOOLGADGET=1,
		GTYP_GADGET0002=2,
		GTYP_PROPGADGET=3,
		GTYP_STRGADGET=4,
		GTYP_CUSTOMGADGET=5,
		GTYP_GTYPEMASK=7,
		GTYP_SYSTYPEMASK=$F0,
		GTYP_WDEPTH=$40,
		GTYP_SDEPTH=$50,
		GTYP_WZOOM=$60,
		GTYP_SUNUSED=$70,
		GMORE_BOUNDS=1,
		GMORE_GADGETHELP=2,
		GMORE_SCROLLRASTER=4

OBJECT BoolInfo
	Flags:UWORD,
	Mask:PTR TO UWORD,
	Reserved:LONG

CONST	BOOLMASK=1

OBJECT PropInfo
	Flags:UWORD,
	HorizPot:UWORD,
	VertPot:UWORD,
	HorizBody:UWORD,
	VertBody:UWORD,
	CWidth:UWORD,
	CHeight:UWORD,
	HPotRes:UWORD,
	VPotRes:UWORD,
	LeftBorder:UWORD,
	TopBorder:UWORD

CONST	AUTOKNOB=1,
		FREEHORIZ=2,
		FREEVERT=4,
		PROPBORDERLESS=8,
		KNOBHIT=$100,
		PROPNEWLOOK=16,
		KNOBHMIN=6,
		KNOBVMIN=4,
		MAXBODY=$FFFF,
		MAXPOT=$FFFF

OBJECT StringInfo
	Buffer:PTR TO CHAR,
	UndoBuffer:PTR TO CHAR,
	BufferPos:INT,
	MaxChars:INT,
	DispPos:INT,
	UnDoPos:INT,
	NumChars:INT,
	DispCount:INT,
	CLeft:INT,
	CTop:INT,
	Extension:PTR TO StringExtend,
	LongInt:LONG,
	AltKeyMap:PTR TO KeyMap

OBJECT IntuiText
	FrontPen:CHAR,
	BackPen:CHAR,
	DrawMode:CHAR,
	LeftEdge:INT,
	TopEdge:INT,
	ITextFont:PTR TO TextAttr,
	IText:PTR TO CHAR,
	NextText:PTR TO IntuiText

OBJECT Border
	LeftEdge:INT,
	TopEdge:INT,
	FrontPen:CHAR,
	BackPen:CHAR,
	DrawMode:CHAR,
	Count:UBYTE,
	XY:PTR TO INT,
	NextBorder:PTR TO Border

CONST	IG_LEFTEDGE=0

OBJECT Image
	LeftEdge:INT,
	TopEdge:INT,
	Width:INT,
	Height:INT,
	Depth:INT,
	ImageData:PTR TO UWORD,
	PlanePick:CHAR,
	PlaneOnOff:CHAR,
	NextImage:PTR TO Image

OBJECT IntuiMessage
	Execmessage:MN,
	Class:LONG,
	Code:UWORD,
	Qualifier:UWORD,
	IAddress:LONG,
	MouseX:INT,
	MouseY:INT,
	Seconds:LONG,
	Micros:LONG,
	IDCMPWindow:PTR TO Window,
	SpecialLink:PTR TO IntuiMessage

OBJECT ExtIntuiMessage
	IntuiMessage:IntuiMessage,
	TabletData:PTR TO TabletData

CONST	IDCMP_SIZEVERIFY=1,
		IDCMP_NEWSIZE=2,
		IDCMP_REFRESHWINDOW=4,
		IDCMP_MOUSEBUTTONS=8,
		IDCMP_MOUSEMOVE=16,
		IDCMP_GADGETDOWN=$20,
		IDCMP_GADGETUP=$40,
		IDCMP_REQSET=$80,
		IDCMP_MENUPICK=$100,
		IDCMP_CLOSEWINDOW=$200,
		IDCMP_RAWKEY=$400,
		IDCMP_REQVERIFY=$800,
		IDCMP_REQCLEAR=$1000,
		IDCMP_MENUVERIFY=$2000,
		IDCMP_NEWPREFS=$4000,
		IDCMP_DISKINSERTED=$8000,
		IDCMP_DISKREMOVED=$10000,
		IDCMP_WBENCHMESSAGE=$20000,
		IDCMP_ACTIVEWINDOW=$40000,
		IDCMP_INACTIVEWINDOW=$80000,
		IDCMP_DELTAMOVE=$100000,
		IDCMP_VANILLAKEY=$200000,
		IDCMP_INTUITICKS=$400000,
		IDCMP_IDCMPUPDATE=$800000,
		IDCMP_MENUHELP=$1000000,
		IDCMP_CHANGEWINDOW=$2000000,
		IDCMP_GADGETHELP=$4000000,
		IDCMP_LONELYMESSAGE=$80000000,
		CWCODE_MOVESIZE=0,
		CWCODE_DEPTH=1,
		MENUHOT=1,
		MENUCANCEL=2,
		MENUWAITING=3,
		OKOK=1,
		OKABORT=4,
		OKCANCEL=2,
		WBENCHOPEN=1,
		WBENCHCLOSE=2

OBJECT IBox
	Left:INT,
	Top:INT,
	Width:INT,
	Height:INT

OBJECT Window
	NextWindow:PTR TO Window,
	LeftEdge:INT,
	TopEdge:INT,
	Width:INT,
	Height:INT,
	MouseY:INT,
	MouseX:INT,
	MinWidth:INT,
	MinHeight:INT,
	MaxWidth:UWORD,
	MaxHeight:UWORD,
	Flags:LONG,
	MenuStrip:PTR TO Menu,
	Title:PTR TO CHAR,
	FirstRequest:PTR TO Requester,
	DMRequest:PTR TO Requester,
	ReqCount:INT,
	WScreen:PTR TO Screen,
	RPort:PTR TO RastPort,
	BorderLeft:CHAR,
	BorderTop:CHAR,
	BorderRight:CHAR,
	BorderBottom:CHAR,
	BorderRPort:PTR TO RastPort,
	FirstGadget:PTR TO Gadget,
	Parent:PTR TO Window,
	Descendant:PTR TO Window,
	Pointer:PTR TO UWORD,
	PtrHeight:CHAR,
	PtrWidth:CHAR,
	XOffset:CHAR,
	YOffset:CHAR,
	IDCMPFlags:LONG,
	UserPort:PTR TO MP,
	WindowPort:PTR TO MP,
	MessageKey:PTR TO IntuiMessage,
	DetailPen:CHAR,
	BlockPen:CHAR,
	CheckMark:PTR TO Image,
	ScreenTitle:PTR TO CHAR,
	GZZMouseX:INT,
	GZZMouseY:INT,
	GZZWidth:INT,
	GZZHeight:INT,
	ExtData:PTR TO CHAR,
	UserData:PTR TO CHAR,
	WLayer:PTR TO Layer,
	IFont:PTR TO TextFont,
	MoreFlags:LONG

CONST	WFLG_SIZEGADGET=1,
		WFLG_DRAGBAR=2,
		WFLG_DEPTHGADGET=4,
		WFLG_CLOSEGADGET=8,
		WFLG_SIZEBRIGHT=16,
		WFLG_SIZEBBOTTOM=$20,
		WFLG_REFRESHBITS=$C0,
		WFLG_SMART_REFRESH=0,
		WFLG_SIMPLE_REFRESH=$40,
		WFLG_SUPER_BITMAP=$80,
		WFLG_OTHER_REFRESH=$C0,
		WFLG_BACKDROP=$100,
		WFLG_REPORTMOUSE=$200,
		WFLG_GIMMEZEROZERO=$400,
		WFLG_BORDERLESS=$800,
		WFLG_ACTIVATE=$1000,
		WFLG_RMBTRAP=$10000,
		WFLG_NOCAREREFRESH=$20000,
		WFLG_NW_EXTENDED=$40000,
		WFLG_NEWLOOKMENUS=$200000,
		WFLG_WINDOWACTIVE=$2000,
		WFLG_INREQUEST=$4000,
		WFLG_MENUSTATE=$8000,
		WFLG_WINDOWREFRESH=$1000000,
		WFLG_WBENCHWINDOW=$2000000,
		WFLG_WINDOWTICKED=$4000000,
		WFLG_VISITOR=$8000000,
		WFLG_ZOOMED=$10000000,
		WFLG_HASZOOM=$20000000,
		SUPER_UNUSED=$FCFC0000,
		DEFAULTMOUSEQUEUE=5

OBJECT NewWindow|NW
	LeftEdge:INT,
	TopEdge:INT,
	Width:INT,
	Height:INT,
	DetailPen:CHAR,
	BlockPen:CHAR,
	IDCMPFlags:LONG,
	Flags:LONG,
	FirstGadget:PTR TO Gadget,
	Checkmark:PTR TO Image,
	Title:PTR TO CHAR,
	Screen:PTR TO Screen,
	BitMap:PTR TO BitMap,
	MinWidth:INT,
	MinHeight:INT,
	MaxWidth:UWORD,
	MaxHeight:UWORD,
	Type:UWORD

OBJECT ExtNewWindow OF NW
	Extension:PTR TO TagItem

CONST	WA_Left=$80000064,
		WA_Top=$80000065,
		WA_Width=$80000066,
		WA_Height=$80000067,
		WA_DetailPen=$80000068,
		WA_BlockPen=$80000069,
		WA_IDCMP=$8000006A,
		WA_Flags=$8000006B,
		WA_Gadgets=$8000006C,
		WA_CheckMark=$8000006D,
		WA_Title=$8000006E,
		WA_ScreenTitle=$8000006F,
		WA_CustomScreen=$80000070,
		WA_SuperBitMap=$80000071,
		WA_MinWidth=$80000072,
		WA_MinHeight=$80000073,
		WA_MaxWidth=$80000074,
		WA_MaxHeight=$80000075,
		WA_InnerWidth=$80000076,
		WA_InnerHeight=$80000077,
		WA_PubScreenName=$80000078,
		WA_PubScreen=$80000079,
		WA_PubScreenFallBack=$8000007A,
		WA_WindowName=$8000007B,
		WA_Colors=$8000007C,
		WA_Zoom=$8000007D,
		WA_MouseQueue=$8000007E,
		WA_BackFill=$8000007F,
		WA_RptQueue=$80000080,
		WA_SizeGadget=$80000081,
		WA_DragBar=$80000082,
		WA_DepthGadget=$80000083,
		WA_CloseGadget=$80000084,
		WA_BackDrop=$80000085,
		WA_ReportMouse=$80000086,
		WA_NoCareRefresh=$80000087,
		WA_BorderLess=$80000088,
		WA_Activate=$80000089,
		WA_RMBTrap=$8000008A,
		WA_WBenchWindow=$8000008B,
		WA_SimpleRefresh=$8000008C,
		WA_SmartRefresh=$8000008D,
		WA_SizeBRight=$8000008E,
		WA_SizeBBottom=$8000008F,
		WA_AutoAdjust=$80000090,
		WA_GimmeZeroZero=$80000091,
		WA_MenuHelp=$80000092,
		WA_NewLookMenus=$80000093,
		WA_AmigaKey=$80000094,
		WA_NotifyDepth=$80000095,
		WA_Obsolete=$80000096,
		WA_Pointer=$80000097,
		WA_BusyPointer=$80000098,
		WA_PointerDelay=$80000099,
		WA_TabletMessages=$8000009A,
		WA_HelpGroup=$8000009B,
		WA_HelpGroupWindow=$8000009C,
		HC_GADGETHELP=1

OBJECT Remember
	NextRemember:PTR TO Remember,
	RememberSize:LONG,
	Memory:PTR TO CHAR

OBJECT ColorSpec
	ColorIndex:INT,
	Red:UWORD,
	Green:UWORD,
	Blue:UWORD

OBJECT EasyStruct
	StructSize:LONG,
	Flags:LONG,
	Title:PTR TO CHAR,
	TextFormat:PTR TO CHAR,
	GadgetFormat:PTR TO CHAR

#define MENUNUM(n) ((n) & $1F)
#define ITEMNUM(n) (((n)>>5) & $3F)
#define SUBNUM(n)  (((n)>>11) & $1F)

#define SHIFTMENU(n) ((n) & $1F)
#define SHIFTITEM(n) (((n) & $3F)<<5)
#define SHIFTSUB(n)  (((n) & $1F)<<11)

#define FULLMENUNUM(menu,item,sub) (SHIFTSUB(sub)|SHIFTITEM(item)|SHIFTMENU(menu))

#define SRBNUM(n)  (8-((n)>>4))
#define SWBNUM(n)  (8-((n) & $F))
#define SSBNUM(n)  (1+((n)>>4))
#define SPARNUM(n) ((n)>>4)
#define SHAKNUM(n) ((n) & $F)

CONST	NOMENU=31,
		NOITEM=$3F,
		NOSUB=31,
		MENUNULL=$FFFF,
		CHECKWIDTH=19,
		COMMWIDTH=27,
		LOWCHECKWIDTH=13,
		LOWCOMMWIDTH=16,
		ALERT_TYPE=$80000000,
		RECOVERY_ALERT=0,
		DEADEND_ALERT=$80000000,
		AUTOFRONTPEN=0,
		AUTOBACKPEN=1,
		AUTODRAWMODE=1,
		AUTOLEFTEDGE=6,
		AUTOTOPEDGE=3,
		AUTOITEXTFONT=0,
		AUTONEXTTEXT=0,
		SELECTUP=$E8,
		SELECTDOWN=$68,
		MENUUP=$E9,
		MENUDOWN=$69,
		MIDDLEUP=$EA,
		MIDDLEDOWN=$6A,
		ALTLEFT=16,
		ALTRIGHT=$20,
		AMIGALEFT=$40,
		AMIGARIGHT=$80,
		AMIGAKEYS=$C0,
		CURSORUP=$4C,
		CURSORLEFT=$4F,
		CURSORRIGHT=$4E,
		CURSORDOWN=$4D,
		KEYCODE_Q=16,
		KEYCODE_Z=$31,
		KEYCODE_X=$32,
		KEYCODE_V=$34,
		KEYCODE_B=$35,
		KEYCODE_N=$36,
		KEYCODE_M=$37,
		KEYCODE_LESS=$38,
		KEYCODE_GREATER=$39,
		TABLETA_Dummy=$8003A000,
		TABLETA_TabletZ=$8003A001,  -> Data for this tag is unsigned INT
		TABLETA_RangeZ=$8003A002,
		TABLETA_AngleX=$8003A003,
		TABLETA_AngleY=$8003A004,
		TABLETA_AngleZ=$8003A005,
		TABLETA_Pressure=$8003A006,
		TABLETA_ButtonBits=$8003A007,
		TABLETA_Inproximity=$8003A008,
		TABLETA_ResolutionX=$8003A009,
		TABLETA_ResolutionY=$8003A00A

OBJECT TabletData
	XFraction:UWORD,
	YFraction:UWORD,
	TabletX:LONG,
	TabletY:LONG,
	RangeX:LONG,
	RangeY:LONG,
	TagList:PTR TO TagItem

OBJECT TabletHookData
	Screen:PTR TO Screen,
	Width:LONG,
	Height:LONG,
	ScreenChanged:LONG
